#include <iostream>

int main(){
    int n,m;
    int a[100]={0},b[100]={0},c[200]={0};
    while(scanf("%d",&n)!=EOF) {
        for (int i = 0; i < n; i++) {
            scanf("%d", &a[i]);
        }
        scanf("%d", &m);
        for (int i = 0; i < m; i++) {
            scanf("%d", &b[i]);
        }
        int i = 0, j = 0;
        for (int t = 0; t < m + n; t++) {
            if (i < n && j < m) {
                if (a[i] < b[j]) {
                    c[t] = a[i];
                    i++;
                } else {
                    c[t] = b[j];
                    j++;
                }
            } else if (i < n) {
                c[t] = a[i];
                i++;
            } else if (j < m) {
                c[t] = b[j];
                j++;
            }
        }
        for (int i = 0; i < n + m; i++) {
            printf("%d ", c[i]);
        }
        printf("\n");
    }
    return 0;
}